using UnityEngine;

public class BulletController : MonoBehaviour
{
    // Start is called before the first frame update
    public GameObject explosionPrefab;
    void Start()
    {
        Invoke("DestroySelf", 3);
    }

    // Update is called once per frame
    void Update()
    {
        this.transform.Translate(0, 0, 1);

    }

    private void OnTriggerEnter(Collider other)
    {
        Destroy(other.gameObject);
        Destroy(this.gameObject);
        GameObject explosionObj = Instantiate(explosionPrefab);
        explosionObj.transform.position = this.transform.position;
    }
    void DestroySelf()
    {
        Destroy(this.gameObject);
    }
}
